
             
/**
 * 
 *
 * @File name:  BatchDeleteTCheckInfoAction.java   批量删除【盘点信息:T_CHECK_INFO】
 * @Create on:  2011-12-05 19:52:615
 * @Author   :  许福辉
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        
package com.boho.estates.usual.action;

            
import java.sql.Connection;
import java.util.Date;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.exception.UserOperationException;
import cn.boho.framework.po.POUtils;
import cn.boho.framework.service.MessageService;

import com.boho.common.SystemUtils;
import com.boho.estates.po.TCheckInfoPO;
            
        

public class BatchDeleteTCheckInfoAction extends ActionImp {
	private Object[] id;
	private Connection con=null;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		if (!(ex instanceof UserOperationException)) {
			atx.setErrorContext("BOHO_COMMON_1003", MessageService.getMessage("BOHO_COMMON_1003"),"【盘点信息】", ex);
		}
	}
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		if(id!=null){
			String updateBy = SystemUtils.getSessionUser(atx);
			for (int i = 0; i < id.length; i++) {
				TCheckInfoPO tCheckInfoPO = new TCheckInfoPO();
				TCheckInfoPO vCheckInfoPO = new TCheckInfoPO();
				tCheckInfoPO.setId(id[i]==null||id[i].toString().trim().equals("")?-1:new Integer((String)id[i]));
				vCheckInfoPO.setIsValid(0);
				vCheckInfoPO.setUpdateBy(updateBy);
				vCheckInfoPO.setUpdateDate(new java.util.Date());
				POUtils.update(con, tCheckInfoPO, vCheckInfoPO, false);
				logger.info("删除操作：" + atx.getStringValue("SESSION_USER_NO") + "@"+ new Date(System.currentTimeMillis())+ "删除表：【盘点信息:T_CHECK_INFO】 主键【"+ id[i] + "】");
			}
		}
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		con = atx.getConection();
		id = atx.getArrayValue("ID");
		return 1;
	}
}
